﻿@*
Licensed to the .NET Foundation under one or more agreements.
The .NET Foundation licenses this file to you under the MIT license.
*@
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
<!doctype html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Script</title>
</head>
<body>
    <h2>Script tag helper test</h2>
    <script src="~/styles/site.js" data-foo="foo-data1" title="&lt;the title>">
        // Regular script with comment in body, and extra properties.
    </script>

    <script src="~/blank.js?a=b&c=d" asp-fallback-src="~/styles/site.js?a=b&c=d" asp-fallback-test="false" data-foo="foo-data2" title="&lt;the title>">
        // TagHelper script with comment in body, and extra properties.
    </script>

    <script src="~/blank.js" asp-fallback-src-include="**/site.js" asp-fallback-test="false" title='"the" title'>
        // Fallback to globbed src
    </script>
    
    <script src="~/styles/siteIntegrity.js?a=integrity"
            asp-fallback-src="~/styles/sub/site2.js?a=integrity"
            asp-fallback-test="true"
            crossorigin="anonymous"
            integrity="sha256-tMQLOHBNPE829MHQPO8metegsGobA/henDPOvtZOWhQ=">
       // Script loading primary source, applied integrity hash to primary source.
    </script>

    <script src="~/styles/siteIntegrity.js?a=integrity"
            asp-fallback-src="~/styles/sub/siteIntegrity2.js?a=integrity"
            asp-fallback-test="false"
            asp-suppress-fallback-integrity="false"
            crossorigin="anonymous"
            integrity="sha256-tMQLOHBNPE829MHQPO8metegsGobA/henDPOvtZOWhQ=">

       // Script uses fallback source, applies integrity hash to fallback.
    </script>

    <script src="~/styles/siteIntegrity.js?a=integrity"
            asp-fallback-src="~/styles/sub/siteIntegrity3.js?a=integrity"
            asp-fallback-test="false"
            asp-suppress-fallback-integrity="true"
            crossorigin="anonymous"
            integrity="sha256-tMQLOHBNPE829MHQPO8metegsGobA/henDPOvtZOWhQ=">
       // Script uses fallback source, ignores integrity hash on fallback.
    </script>

    <script src="~/blank.js"
            asp-fallback-src-include="**/styles/**/*.js"
            asp-fallback-src-exclude="**/site3.js"
            asp-fallback-test="false">
        // Fallback to globbed src with exclude
    </script>

    <script src="~/blank.js"
            asp-fallback-src="~/styles/site.js"
            asp-fallback-src-include="**/site2.js"
            asp-fallback-test="false">
        // Fallback to globbed and static src
    </script>

    <script src="~/blank.js"
            asp-fallback-src="~/styles/site.js"
            asp-fallback-src-include="**/site.js"
            asp-fallback-test="false">
        // Fallback to globbed and static src should de-dupe
    </script>

    <script src="~/blank.js" asp-fallback-src-exclude="**/site3.js" asp-fallback-test="false">
        // Fallback to globbed src with missing include
    </script>

    <script src="~/blank.js"
            asp-fallback-src="~/styles/site.js"
            asp-fallback-src-exclude="**/site3.js"
            asp-fallback-test="false">
        // Fallback to static and globbed src with missing include
    </script>

    <script src="~/blank.js" asp-fallback-src-include="**/appRoot.js" asp-fallback-test="false">
        // Fallback to globbed src outside of webroot
    </script>

    <script src="~/blank.js" asp-fallback-src-include="../**/appRoot.js" asp-fallback-test="false">
        // Fallback to globbed src outside of webroot
    </script>

    <script asp-fallback-src="~/styles/site.js" asp-fallback-test="false" data-foo="foo-data3">
        // Valid TagHelper (although no src is provided) script with comment in body, and extra properties.
    </script>

    <script src="~/blank.js" asp-fallback-src="~/styles/site.js">
        // Invalid TagHelper script with comment in body.
    </script>

    <!-- Globbed script tag with existing file -->
    <script asp-src-include="**/site.js">
        // This comment shouldn't be emitted
    </script>

    <!-- Globbed script tag with existing file and exclude -->
    <script asp-src-include="**/styles/**/*.js" asp-src-exclude="**/site3.js">
        // This comment shouldn't be emitted
    </script>

    <script asp-src-exclude="**/site2.js">
        // Globbed script tag missing include
    </script>

    <script src="~/styles/site.js" asp-src-exclude="**/site2.js">
        // Globbed script tag missing include but with static src
    </script>

    <!-- Globbed script tag with comma separated include pattern -->
    <script asp-src-include="~/styles/*.js, ~/styles/sub/*.js"></script>

    <!-- Globbed script tag with missing file -->
    <script asp-src-include="**/notThere.js"></script>

    <!-- Globbed script tag with file outside of webroot -->
    <script asp-src-include="../**/appRoot.js"></script>

    <!-- Globbed script tag with file outside of webroot -->
    <script asp-src-include="**/appRoot.js"></script>

    <script src="~/styles/site.js" asp-src-include="**/site2.js">
        // Globbed script tag with existing file and static src
    </script>

    <script src="~/styles/site.js" asp-src-include="**/site.js">
        // Globbed script tag with existing file and static src should dedupe
    </script>

    <script src="~/blank.js" asp-fallback-src="~/styles/site.js" asp-fallback-test="false" asp-append-version="true">
        // TagHelper script with comment in body, and file version.
    </script>

    <script src="~/blank.js" asp-fallback-src-include="**/site.js" asp-fallback-test="false" asp-append-version="true">
        // Fallback to globbed src with file version.
    </script>

    <script src="~/styles/site.js" asp-append-version="true">
        // Regular script with comment in body, and file version.
    </script>

    <!-- Globbed script tag with existing files and version -->
    <script asp-src-include="**/styles/**/*.js" asp-append-version="true">
        // This comment shouldn't be emitted
    </script>

    <!-- Globbed script tag with existing file, exclude and version -->
    <script asp-src-include="**/styles/**/*.js" asp-src-exclude="**/site3.js" asp-append-version="true">
        // This comment shouldn't be emitted
    </script>
</body>
</html>